package com.xiaobaibai.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()//下面是暴露的接口
                //Controller类所在的包
                .apis(RequestHandlerSelectors.basePackage("com.xiaobaibai.controller"))
                //暴露下的所有url都可以访问
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        //文档标题
                        .title("微信mall小程序")
                        //文档描述
                        .description("小白白不白")
                        //项目版本号
                        .version("1.0")
                        //描述下面的可跳转信息+邮箱
//                        .contact(new Contact("啊啊啊啊","blog.csdn.net","aaa@gmail.com"))
                        //也是可跳转信息
//                        .license("The Apache License")
//                        .licenseUrl("http://www.baidu.com")
                        .build());
    }

}
